<template>
  <div>
    <ul>
      <li
        v-for="(item, index) in arr"
        :key="index"
        :class="item.id === id ? 'navA' : ''"
        @mouseout="out(item.id)"
        @mouseover="over(item.id)"
      >
        {{ item.tit }}
      </li>
    </ul>
    <div class="wow">
      <div
        v-for="(item, index) in arr"
        :key="index"
        class="info"
        :class="
          id == '1' ? 'box' : id == '2' ? 'box1' : id == '3' ? 'box3' : ''
        "
      >
        <div class="waw">
          {{ item.info }}
        </div>
        <div class="waw">
          {{ item.info }}
        </div>
        <div class="waw">
          {{ item.info }}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      id: '1',
      arr: [
        {
          tit: '国家政策',
          id: '1',
          info: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
        },
        {
          tit: '地区政策',
          id: '2',
          info: 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
        },
        {
          tit: '产业政策',
          id: '3',
          info: 'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc'
        }
      ]
    }
  },
  methods: {
    over(id) {
      this.id = id
    },
    out(id) {
      this.id = id
    }
  }
}
</script>

<style lang="less" scoped>
ul {
  width: 800px;
  height: 240px;
  text-align: center;
  display: flex;
  list-style: none;
  border: 1px solid black;
  li {
    width: 200px;
    height: 200px;
    line-height: 200px;
    font-size: 30px;
    color: #aaa;
    position: relative;
    border: 1px solid black;
    margin: 20px;
  }
  .navA {
    color: rgb(160, 238, 252);
    border-bottom: 2px solid rgb(160, 238, 252);
  }
}
.wow {
  width: 1000px;
  height: 300px;
  // border: 1px solid black;
  overflow: hidden;
  display: flex;
  .info {
    width: 1000px;
    height: 300px;
    background-color: aquamarine;
    // border: 1px solid black;
    transition: 0.75s;
    flex-shrink: 0;
  }
  .box {
    color: black;
    position: relative;
    left: 0px;
  }
  .box1 {
    color: green;
    position: relative;
    left: -1000px;
    background-color: blueviolet;
  }
  .box3 {
    color: red;
    position: relative;
    left: -2000px;
    background-color: bisque;
  }
}
.waw {
  margin: 20px;
  width: 600px;
  height: 50px;
  background: linear-gradient(to left, rgb(160, 238, 252) 50%, #fff 50%);
  background-size: 200% 100%;
  background-position: bottom left;
  transition: all 0.75s;
}
.waw:hover {
  background-position: bottom right;
}
</style>
